package 笔试记录.M9day20bilibili;

import java.util.Scanner;

public class Main2 {
    //奇数位为正，找奇数位置上的最小值
    //偶数位为负，找偶数位的最大值
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int size = sc.nextInt();
        int[] arr = new int[size + 1];
        int max = Integer.MIN_VALUE;
        int max_index = -1;
        int min = Integer.MAX_VALUE;
        int min_index = -1;

        for (int i = 1; i < arr.length; i++) {
            arr[i] = sc.nextInt();
            if(i % 2 != 0){
                if(min > arr[i]){
                    min = arr[i];
                    min_index = i;
                }
            }else{
                if(max < arr[i]){
                    max = arr[i];
                    max_index = i;
                }
            }
        }

        //交换
        int tmp =arr[min_index];
        arr[min_index] = arr[max_index];
        arr[max_index] = tmp;

        int sum = 0;
        int num = 0;
        for (int i = 1; i < arr.length; i++) {
            if(i % 2 != 0){
                num = arr[i];
            }else{
                num = -arr[i];
            }
            sum += num;
        }
        System.out.println(Math.max((sum + 2 * max - 2 * min),sum));
    }
}
